/**
 * @组件处理器
 * @returns style模板 数据 组件
 */
import {getAttribute} from '@/utils'
const handler = (newAttribute,newdata) => {
    let attribute = [{
        key:'width',
        name:'宽度',
        type:'input',
        value:'100',
        placeholder:'请输入宽度'
    },{
        key:'height',
        name:'高度',
        type:'input',
        value:'40',
        placeholder:'请输入高度'
    },{
        key:'color',
        name:'文本颜色',
        type:'color',
        value:'#ff0000',
        placeholder:'请输入文本颜色'
    },{
        key:'fontSize',
        name:'字体大小',
        type:'input',
        value:'16',
        placeholder:'请输入字体大小'
    }]
    if(newAttribute){
        attribute = newAttribute
    }
    let data = { text:'我是文本组件' }
    if(newdata){
        // 过来是字符串反解析
        data = JSON.parse(newdata)
    }
    let template = `<v-text ${getAttribute(attribute)} data='${JSON.stringify(data)}'></v-text>`
    console.log('new',data);
    return {attribute,data,template}
}

export default handler